<div class="d-flex justify-content-between align-items-center" id="<%= spree_dom_id(payment) %>">
  <div class="w-40">
    <%= render 'spree/shared/payment', payment: payment %>
  </div>
  <div class="text-xs text-muted w-20">
    <%= local_time(payment.updated_at) %>
  </div>

  <div class="text-xs text-muted w-15">
    <%= payment_state_badge(payment.state) %>
  </div>

  <div class="text-xs text-muted w-10">
    <%= payment.display_amount %>
  </div>

  <div class="w-10 d-flex justify-content-end">
    <div class="dropdown">
      <button class="btn btn-light btn-sm" type="button" data-toggle="dropdown" aria-expanded="false">
        <%= icon('dots', class: 'mr-0') %>
      </button>
      <div class="dropdown-menu">
        <% if payment.try(:gateway_dashboard_payment_url).present? %>
          <%= link_to_with_icon 'eye', Spree.t(:details), payment.gateway_dashboard_payment_url, class: 'dropdown-item', target: '_blank' %>
        <% end %>
        <% if payment.source.is_a?(Spree::StoreCredit) && payment.source.gift_card %>
          <%= link_to_with_icon 'eye', Spree.t(:details), spree.edit_admin_gift_card_path(payment.source.gift_card), class: 'dropdown-item' %>
        <% end %>

        <% if payment.checkout? || payment.pending? %>
          <%= link_to_with_icon 'check', Spree.t(:capture), spree.capture_admin_order_payment_path(@order, payment), class: 'dropdown-item', data: { turbo_method: :put, turbo_confirm: Spree.t(:are_you_sure) } %>
        <% end %>
        <% if can?(:refund, @order) && (payment.completed? || payment.pending?) %>
          <%= link_to_with_icon 'credit-card-refund', Spree.t(:refund), spree.new_admin_order_payment_refund_path(@order, payment), class: 'dropdown-item' %>
        <% end %>
        <% if payment.void? || payment.pending? %>
          <%= link_to_with_icon 'cancel', Spree.t(:void), spree.void_admin_order_payment_path(@order, payment), class: 'dropdown-item', data: { turbo_method: :put, turbo_confirm: Spree.t(:are_you_sure) } %>
        <% end %>
        <% if payment.checkout? && payment.can_be_deleted? %>
          <div class="dropdown-divider"></div>
          <%= link_to_with_icon 'trash', Spree.t('actions.destroy'), spree.admin_order_payment_path(@order, payment), class: 'dropdown-item btn-danger', data: { turbo_method: :delete, turbo_confirm: Spree.t(:are_you_sure) } %>
        <% end %>
      </div>
    </div>
  </div>
</div>
